<template>
  <div class="component__combo_card" @click="toPath(detail.id)">
    <div :class="['combo-box', bottomInline ? 'bottom' : '']">
      <div class="combo-left">
        <img v-if="detail.cover" :src="detail.cover" alt="" />
        <img v-else src="/img/mobile/course-combo-bg.png" alt="" />
        <div class="tips">套餐</div>
      </div>
      <div class="combo-right">
        <div class="combo-name">
          {{ detail.comboName }}
        </div>
        <div class="combo-info">
          {{ detail.introduce }}
        </div>
        <div class="student-price">
          <div class="student">已有{{ detail.studentSum }}人购买</div>
          <div class="price">
            ￥<span>{{ detail.currentPrice }}</span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { mapState } from "vuex";
export default {
  props: ["detail", "bottomInline"],
  components: {},
  data() {
    return {};
  },
  computed: {
    ...mapState({
      is_ios(state) {
        return state.is_ios;
      },
      is_in_wechat(state) {
        return state.is_in_wechat;
      },
      member_discount(state) {
        return state.member_discount;
      },
      is_hidden_content(state) {
        return state.is_hidden_content;
      },
      is_wechat_ios_limit(state) {
        return state.is_wechat_ios_limit;
      }
    }),
    is_show_price() {
      if (this.is_wechat_ios_limit) {
        return this.is_ios && this.is_in_wechat;
      } else {
        return false;
      }
    }
  },
  watch: {},
  methods: {
    toPath(id) {
      this.$router.push({
        path: "/m/combo-detail",
        query: {
          id
        }
      });
    }
  },
  created() {
    console.log(this.detail);
  },
  mounted() {}
};
</script>

<style lang="scss" scoped>
.component__combo_card {
  width: 6.8rem;
  box-sizing: content-box;
  padding: 0 0.2rem;
  .combo-box {
    height: 2.304rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    .combo-left {
      width: 2.592rem;
      height: 1.728rem;
      position: relative;
      background: var(--theme-color);
      border-radius: 0.04rem;
      //   overflow: hidden;
      img {
        width: 100%;
        height: 100%;
        display: block;
        border-radius: 0.04rem;
      }
      .tips {
        position: absolute;
        left: 0.1rem;
        top: -0.04rem;
        width: 0.576rem;
        height: 0.3552rem;
        background-color: #ff6868;
        color: #ffffff;
        border-radius: 0px 0px 0.096rem 0.096rem;
        font-size: 0.192rem;
        text-align: center;
        line-height: 0.3552rem;
      }
    }
    .combo-right {
      width: 3.9rem;
      height: 1.728rem;
      .combo-name {
        font-size: 0.2688rem;
        font-weight: bold;
        line-height: 0.34559rem;
        color: #494a4d;
        display: -webkit-box;
        -webkit-line-clamp: 1;
        overflow: hidden;
        text-overflow: ellipsis;
        -webkit-box-orient: vertical;
        margin: 0.1rem 0;
      }
      .combo-info {
        font-size: 0.2304rem;
        font-weight: bold;
        line-height: 0.3rem;
        height: 0.6rem;
        color: #949699;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        overflow: hidden;
        text-overflow: ellipsis;
        -webkit-box-orient: vertical;
      }
      .student-price {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.2rem 0 0.1rem;
        .student {
          font-size: 0.24rem;
          // font-weight: bold;
          line-height: 0.3rem;
          color: #adafb3;
        }
        .price {
          color: var(--theme-color);
          span {
            font-size: 0.384rem;
          }
        }
      }
    }
  }
  .combo-box.bottom {
    border-bottom: solid 0.02rem #ededf1;
  }
}
</style>
<style lang="scss">
.component__combo_card {
}
</style>
